package com.my.ph.controller;

import com.my.ph.config.entity.UserJsonConfig;
import com.my.ph.util.R;
import com.my.ph.util.UserJsonConfigUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/setting")
@RequiredArgsConstructor
public class SystemSettingController {

    @GetMapping("/get")
    public R<UserJsonConfig> get() {
        return R.ok(UserJsonConfigUtil.getInstance());
    }

    @PostMapping("/update")
    public R<?> update(@RequestBody UserJsonConfig userJsonConfig) {
        UserJsonConfigUtil.update(userJsonConfig);
        return R.ok();
    }

}
